
function truncateString(str, num) {
	let len = str.length;
	if (len > num) {
		return str.slice(0, num) + '...';
	} else {
		return str;
	}
}


console.log(truncateString("A-tisket a-tasket A green and yellow basket", 8));
